<?php
  header('Content-Type:text/html;charset=utf-8');
  require_once 'class.php';
  $email=$_POST['email'];
  $id=$_POST['id'];
  session_start();
  PDOc::_connect();
  if (PDOc::checkEmailValidity($email)) {
  	if (!PDOc::checkEmailExistence($email)) {
  		PDOc::updateEmail($id,$email);
  		$_SESSION['email']=$email;
  	} else {
  		PDOc::throwException('邮箱地址已被注册！');
  		PDOc::Button('ModifyEmail.php','返回修改页面');
  	}
  } else {
  	PDOc::throwException('邮箱地址不合法！');
    PDOc::Button('ModifyEmail.php','返回修改页面');
  }
?>